package model

import (
	"api-getaway/basic/config"
	"gorm.io/gorm"
)

type Video struct {
	gorm.Model
	Title  string `gorm:"type:varchar(30);not null;comment:'标题'"`
	Class  string `gorm:"type:varchar(50);not null;comment:'分类'"`
	Region string `gorm:"type:varchar(20);not null;comment:'地区'"`
	Cover  string `gorm:"type:varchar(500);not null;comment:'封面'"`
}

func (v *Video) CreateVideo() error {
	return config.DB.Debug().Create(&v).Error
}

type VideoCheckRecord struct {
	gorm.Model
	VideoId     int    `gorm:"type:int;not null;index;comment:'视频ID'"`
	CheckStatus int    `gorm:"type:tinyint;not null;index;default:0;comment:'审核状态：0-待审核 1-审核通过 2-审核拒绝'"`
	CheckReason string `gorm:"type:varchar(100);index;comment:'审核原因'"`
	CheckUserId int    `gorm:"type:int;not null;index;comment:'审核用户ID'"`
}

func (vc *VideoCheckRecord) CreateVideoCheckRecord() error {
	return config.DB.Debug().Create(&vc).Error
}

type VideoEpisode struct {
	gorm.Model
	VideoId  int    `gorm:"type:int;not null;index;comment:'视频id'"`
	Title    string `gorm:"type:varchar(50);not null;index;comment:'剧集标题'"`
	Desc     string `gorm:"type:varchar(100);not null;index;comment:'剧集描述'"`
	CoverUrl string `gorm:"type:varchar(100);not null;index;comment:'剧集封面'"`
	Episode  int    `gorm:"type:int;not null;default:0;comment:'剧集'"`
	IsFree   int    `gorm:"type:tinyint;not null;index;default:0;comment:'是否免费：0-免费 1-付费'"`
}
